Repository navigation
0.10.12: a pair's cluster service restarts into the installed release after an update - #2033
Merged
jonathan308 merged 4 commits intoNov 12, 2026
Conversation
…r release (red) W1-D2 (0.10.12 W1, pair-2): after `darkbloom update` on both Macs, a pair that serves only on its local API kept both cluster services (supervisor and service) on 0.10.10-dev.branch.175 while their parts ran .176. The supervisor's pair cycle does not drain such a pair (ClusterPairUpdateCycle.livePart: localOnly or solo is undrainable), so it never restarts into the installed release; `restart` restarts only the parts. Only a login, a supervisor crash or `launchctl kickstart -k` did. The tests start a part of the installed release under a supervisor whose state file names an earlier release, with launchd's `print` and the kickstart stood in: it must restart the service's job once (W1's DevNet build numbers and 0.10.11 -> 0.10.12), never for a service on this or a newer release, a process that is not the supervised service's part, a supervisor that is not the launchd job, or the same release twice within six hours. The stub has today's behaviour (nothing restarts), so they fail on the restart expectations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… after an update W1-D2 (0.10.12 W1, pair-2): after `darkbloom update` on both Macs, a pair serving only on its local API kept its cluster service (supervisor and service) on the earlier release. The supervisor's pair cycle does not drain such a pair (ClusterPairUpdateCycle.livePart: localOnly or a solo part is undrainable), so it gave the restart up; the old service set the pair up again from the installed binary, so only the parts ran the new release. `update` again said "Already up to date" and `restart` restarted the parts. The update to a release is decided by the release it updates from, so the fix has to run in the new release's own processes: the parts. ClusterServiceStaleRestart: at the start of a part of a supervised cluster service (its heartbeat file is part-health.json, ClusterService .partEnvironment), when the supervisor's state file names an older release than the part's (SemanticVersion, DevNet build numbers included), the part's parent is the service that supervisor runs, and the supervisor is the process this build's launchd job runs, the part asks launchd to restart the job (`launchctl kickstart -k`, in the background) and starts nothing for up to 20 s, so the service's stop ends it before it loads a model. Once per installed release in 6 hours (service-restart-asked.json, written before the ask), so it can never loop. Called first in `start` (rank 0, a coordinator-paired part, a solo server) and `cluster link-follower`; any other process returns at once without reading a file. Docs: cluster-always-on (the coordinated update, troubleshooting), two-mac-cluster, cli-reference (`darkbloom update`). Changelog fragment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…, the stop during the wait (red) The independent review (review-2033.md S1-S3) found: - S1: a `start` part runs under the AppKit host, which has already taken SIGTERM and SIGINT (ProviderSignalHandler: ignored, read by dispatch sources) before Start.run(). So the service's stop does not end the part during the 20 s wait after the ask, as the comment claimed; it sleeps the whole wait, then carries on starting. - S2: the ask is made even when its 6 h record could not be written. - S3: four of the reviewer's mutants passed the PR's tests: a plain string comparison of the versions, the 6 h record keyed on the supervisor's release, the record written after the ask, and launchctl print of another job. New tests: - the releases' order decides, never the text's: DevNet build 99 -> 100 and 176 -> 177 (W1's morning case), 0.10.9 -> 0.10.10 and 0.10.12, 0.10.9-dev -> 0.10.12-dev, and the reverse and equal cases; - a newer installed release asks again within 6 h; - launchctl print asks for this build's label, and the record is on disk when launchd is asked; - a supervisor with no service running (before a re-exec) is left alone; - `kickstart -k` is what launchctl is asked, and its refusal is said; - an ask that can't be recorded is not made (red: S2); - in a child with SIGTERM and SIGINT taken as the AppKit host takes them, a SIGTERM during the wait ends the process (red: S1), and after the wait the handlers are back. Seams with today's behaviour: waitForStop(seconds:) is the plain sleep, and kickInBackground takes the launchctl runner. Red here: the S1 and S2 tests; the order, record and label tests pass, and fail on the reviewer's mutants (string order, M9, M12, M15, M17). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sk only once recorded The independent review (review-2033.md, S1 and S2): - S1: the 20 s wait after the ask did not end at the service's stop for a `start` part, as the earlier commit said it would. Rank 0, a coordinator-paired part and a solo server run under the AppKit host, which takes SIGTERM and SIGINT for the provider's own drain before Start.run() (ProviderSignalHandler: ignored, read by dispatch sources), so a SIGTERM was only noted: the part slept the whole wait, then carried on starting. Only `cluster link-follower` ended at once. waitForStop now gives SIGTERM and SIGINT their default action for the wait and then gives them back what they had (sigaction), so the stop ends every part at once and a part that nothing stopped starts as before. - S2: the ask is made only once its 6 h record is written. A record that can't be written means no restart, said in the part's log, so the no-loop property doesn't depend on launchctl. Docs: cluster-always-on (the coordinated update, step 4): the order is the releases', the parent check, the record before the ask, and the wait's signals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308
merged commit Nov 12, 2026
714c019
into
release/candidate-0.10.12d
45 of 48 checks passed
This was referenced Nov 12, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft for the 0.10.12 publish (W1-D2), into
release/candidate-0.10.12d(0b52123a18).Why
W1 on DevNet
0.10.12-dev.branch.176(pair-2: M3 Ultra Studio + M5 Max MacBook, a pair serving only on its local API;W1-0112.mdW1-D2): afterdarkbloom-dev updateon both Macs, both cluster services (supervisor and service) stayed on0.10.10-dev.branch.175. The parts and workers ran.176.updateagain said "Already up to date";restartrestarted only the parts. Onlylaunchctl kickstart -kof the service's job fixed it.Cause (file:line at
0b52123a18;ClusterPairUpdateCycle.swiftandUpdateCommand.swiftare byte-identical atv0.10.11)darkbloom updateinstalls, then asks the supervisor (cluster service --supervise, launchd jobio.darkbloom.cluster-service[.dev].<12 hex>) to restart into the release (UpdateCommand.swift:315-323). The supervisor restarts only at the end of the pair's cycle (ClusterMemberSupervisor.swift:634-643restartForUpdate→:176-181→:503-513execv).ClusterPairUpdateCycle.livePartreturns.undrainable(ClusterPairUpdateCycle.swift:612). The cycle then refuses to stage (:309) or to drain (:365-366,:420) and ends deferred (W1's log: "this Mac's part does not drain for an update").ClusterService.swift:1385-1430, "Darkbloom changed on both Macs"), so it starts the parts from the installed binary while it keeps running the old one.KeepAliveis{SuccessfulExit: false}withRunAtLoad(ClusterServiceAgentPlan.swift:146-151).updatewith nothing to install prints "Already up to date" and returns (UpdateCommand.swift:145-146).restartstops and serves the pair through the running service (RestartCommand.swift:91-98,ClusterPairCommands.swift:193-218).Coordinator-paired parts answer the drain (
StartCommand+ClusterMember.swift:142), so those pairs restart through the cycle and aren't affected. Production pairs are coordinator-paired: none is serving now, and 7 accounts had one in the last 7 days.Production-only symptom. Production's versions compare numerically, which DevNet's
0.10.x-dev.branch.Nstrings don't (ClusterOnboardingFlow.swift:1303-1314). So on the leading Mac, the 0.10.12 CLI compares itself with the other Mac's stale service (ClusterOnboardingLive+VersionSplit.swift:9-19) and reports "the two Macs run different Darkbloom versions" (ClusterOnboardingLive.swift:2463, a final reason atClusterPairSummary.swift:555). Its remedy isdarkbloom updateon the other Mac, which only says "Already up to date". This is from reading the code, not reproduced: W1's DevNet build can't show it.Fix
ClusterServiceStaleRestart(ProviderCore/Service/ClusterSupervision) runs first in a cluster part:start(rank 0, a coordinator-paired part, a solo server) andcluster link-follower. These are the first processes of the installed release on such a Mac, and they start before the pair takes any request. A part restarts its service's launchd job (launchctl kickstart -k, in the background) only when all of these hold:part-health.json(ClusterService.partEnvironment; 0.10.11's service passes the same);service-supervisor.jsonnames an older release than the part (SemanticVersion, DevNet build numbers included);current.pid);launchctl printpid);service-restart-asked.jsonfirst; if the record can't be written, the part doesn't ask, and its log says so.The part then starts nothing for up to 20 s, with SIGTERM and SIGINT at their default action (
waitForStop), so the service's stop ends it at once, before it loads a model.startpart runs under the AppKit host. ItsProviderSignalHandlerhas already taken both signals for the provider's own drain (ignored, read by dispatch sources), so without this the stop was only noted and the part slept the whole wait. This corrects the first version's claim that SIGTERM ended a part with no handler yet; that held only forcluster link-follower.The service stops as at a logout and keeps the pair's saved start, and the new supervisor starts the pair again on the installed release: W1's manual kickstart at 06:23:19Z did exactly this. Any other process returns at once without reading a file.
Risks, and how this limits them:
Docs:
cluster-always-on.md(the coordinated update, step 4, and troubleshooting),two-mac-cluster.md,cli-reference.md(darkbloom update). Changelog fragmentchangelog.d/cluster-service-restart-after-update.md.Review delta (
review-2033.mdS1–S3),a6d3e6beb5..16b1a18bdaSemanticVersion), never the text's: DevNet build 99 → 100 and 176 → 177 (W1's morning case), 0.10.9 → 0.10.10 and 0.10.12, 0.10.9-dev → 0.10.12-dev, each in reverse, and equal versions: 11 cases;printasks for this build's label, and the record is on disk when launchd is asked;kickstart -kis what launchctl gets, and a refusal is logged (kickInBackgroundtakes its runner);cluster-always-on.mdstep 4 (the release order, the parent check, the record before the ask, the wait's signals).Tests (red first)
Review delta:
6ceeb398e9: the new tests, plus two seams that keep today's behaviour (waitForStopis the plain sleep, andkickInBackgroundtakes its runner). CI on it alone: DO NOT MERGE: red run for #2033's review delta (S1-S3) #2036 (DO NOT MERGE). Locally, with the reviewer's harness (the real file and its real dependencies, swift-testing), exactly two tests fail: the S2 test (3 issues) and the S1 exit test (expected .signal(SIGTERM), got exit 0 after the 5 s wait). The rest pass.16b1a18bda: 15 tests (with the 11 order cases) pass locally.printof another job (M15),kickstartwithout-k(M17), the wait leaving the signals as they are, no restore, and asking despite a failed record.ProviderCoreemits anddarkbloomtypechecks against the release build's modules.changelog,docs-impactandcheck-date-comparisonspass.First version:
89e2427505(tests and a stub with today's behaviour: nothing restarts).ClusterServiceStaleRestartTestsuses a temporary service folder and stand-ins forlaunchctl printand the kickstart:.175→.176, and a second part start asks nothing;launchctl print.CI on the red commit alone: DO NOT MERGE: red run for 0.10.12 pair cluster service restart after an update #2032 (DO NOT MERGE).
a6d3e6beb5: the fix.ProviderCoreemits anddarkbloomtypechecks against the 0.10.12 release build's modules;ProviderCoreTeststypechecks except 3 errors in files the harness can't build (MockCoordinator, unrelated). TheSemanticVersionandlaunchctl printparsing were checked standalone.changelog check,docs-impact(vs0b52123a18) andcheck-date-comparisonspass. I didn't run the tests locally: Mac A was at 21–24 GiB free.Proof on a real update
The morning W1 delta on pair-2 can prove it: the next DevNet build with this, then
updateon both Macs of a local-only pair. Expected:cluster part: this Mac's cluster service still runs v… while v… is installed …in each part's log;psshows a new supervisor and service, andservice-update.jsonsays the new release, with no manual kickstart;The reviewer's §8 has the full checklist.
Status
16b1a18bda(the review delta): all green (run 43184550744).actions/checkouthit "RPC failed; curl 92 … early EOF", and shard 3's runner never ran a step. Re-running the failed jobs (attempt 2) passed them.6ceeb398e9(closed after reading): shard 2 failed exactly on the S1 exit test and the S2 test: 4 issues in total ("2857 tests … failed … with 4 issues"). Shard 1 and every cluster job passed.a6d3e6beb5was all green (run 43174492897), and shard 2 ran the 7 tests then. The red run, DO NOT MERGE: red run for 0.10.12 pair cluster service restart after an update #2032 on89e2427505, failed exactly on those tests: 3 tests, 11 issues. Shard 1 of that run had one unrelated failure,DistributedHTTPVisibleContentTests.streamedToolCallEndsWithToolCallsFinish().